<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/include/taglib.jsp"%>
<%@ page import="java.sql.*" %>
<%					//连接数据库
	String driverName="com.mysql.jdbc.Driver";    //Mysql数据库连接
	String userName="root";    
	String psw="123456";     //本行和上一行是数据库的登录名和密码
	String dbName="test1";	   //数据库名字
	String url="jdbc:mysql://localhost:3306/test1?serverTimezone=UTC";
	Class.forName("com.mysql.jdbc.Driver");	 
	Connection conn=DriverManager.getConnection(url,userName,psw); 
	Statement stmt=conn.createStatement(); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="${ctx}/layui/css/layui.css">
<link rel="stylesheet" href="${ctx }/css/font_eolqem241z66flxr.css"
	media="all" />
<link rel="stylesheet" href="${ctx }/css/list.css" media="all" />
<script>
	var ctx = "${ctx}";
</script>
</head>
<body class="childrenBody">
	<blockquote class="layui-elem-quote list_search">
		<div class="layui-inline">
			<a class="layui-btn layui-btn-normal productAdd_btn"><i
				class="layui-icon">&#xe608;</i> 添加产品</a>
		</div>

		<form class="layui-form">
			<div class="layui-inline">
				<div class="layui-input-inline">
					<!-- <input type="text" id="productName" value="" placeholder="请输入商品名称"
						class="layui-input search_input "> -->
							<select name="productName" id="productName"
						class="layui-input search_input"
						lay-search="">
						<option value="">--请选择要搜索的商品名称--</option>
		
						<%
							
							ResultSet rs1 = stmt.executeQuery("SELECT product.product_name,product.product_id FROM product");

							while (rs1.next()) //循环输出数据
							{
								out.print("<option value=" + rs1.getString("product_name") + ">" + rs1.getString("product_name")
										+ "</option>");
							}
							
						%>
					</select>
				</div>


				<div class="layui-input-inline">
					<!-- <input type="text" id="productBrand" value="" placeholder="请输入产品品牌"
						class="layui-input search_input "> -->
						<select name="productName" id="productName"
						class="layui-input search_input"
						lay-search="">
						<option value="">--请选择要搜索的商品品牌--</option>
		
						<%
							
							ResultSet rs2 = stmt.executeQuery("SELECT DISTINCT product.product_name,product.product_brand FROM product");

							while (rs2.next()) //循环输出数据
							{
								out.print("<option value=" + rs2.getString("product_brand") + ">" + rs2.getString("product_brand")
										+ "</option>");
							}
							
						%>
					</select>
				</div>
				<div class="layui-input-inline">
					<select name="classificationId" id="classificationId"
						class="layui-input search_input">
						<option value="">--请选择--</option>
						 <%

     				ResultSet rs=stmt.executeQuery("SELECT classification.product_classification,classification.classification_id FROM classification");
     				while(rs.next())   //循环输出数据
     				{
          				out.print("<option value="+rs.getInt("classification_id")+">"+rs.getString("product_classification")+"</option>");
     				}
				%> 
						<!-- <option value="彩妆">彩妆</option>
						<option value="品牌箱包">品牌箱包</option>
						<option value="鞋履">鞋履</option>
						<option value="女士穿搭">女士穿搭</option>
						<option value="男士护肤">男士护肤</option>
						<option value="内衣">内衣</option>
						<option value="品质男装">品质男装</option>
						<option value="运动">运动</option>
						<option value="钟表配饰">钟表配饰</option>
						<option value="居家">居家</option>
						<option value="食品保健">食品保健</option>
						<option value="母婴">母婴</option>
						<option value="数码家电">数码家电</option>
						<option value="护肤">护肤</option> -->
					</select>
				</div>
				<div class="layui-input-inline">
					<!-- <input type="text" id="productName" value="" placeholder="请输入商品名称"
						class="layui-input search_input "> -->
							<select name="productShelf" id="productShelf"
						class="layui-input search_input"
						lay-search="">
						<option value="">--请选择要进行检索的商品状态--</option>
						<option value="1">上架</option>
						<option value="0">下架</option>
					</select>
				</div>
				<a style="margin-left: 10px" class="layui-btn search_btn"
					lay-submit="" data-type="search" lay-filter="search">查询</a>

			</div>

		</form>

	</blockquote>
	<!-- 数据表格 -->
	<table id="productList" class="productList" lay-filter="productList"></table>
	<script type="text/javascript" src="${ctx }/layui/layui.js"></script>
	<script type="text/javascript" src="${ctx }/js/product/productList.js"></script>
	<script type="text/html" id="barEdit">
		<a class="layui-btn layui-btn-sm" lay-event="edit">
            <i class="layui-icon">&#xe642;</i>
        </a>
        <a class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">
            <i class="layui-icon">&#xe640;</i>
        </a>
        <a class="layui-btn layui-btn-sm layui-btn-danger" lay-event="delivery">
            <i class="layui-icon">图片</i>
        </a>

    </script>
	<script type="text/html" id="switchTpl">
  <!-- 这里的 checked 的状态只是演示 -->
  <input type="checkbox" name="productRecommend" value="{{d.productId}}" lay-skin="switch" lay-text="是|否" lay-filter="sexDemo" {{ d.productRecommend == 1 ? 'checked' : '' }}>
</script>
	<script type="text/html" id="switchTpl1">
  <!-- 这里的 checked 的状态只是演示 -->
  <input type="checkbox" name="productShelf" value="{{d.productId}}" lay-skin="switch" lay-text="上架|下架" lay-filter="sexDemo1" {{ d.productShelf == 1 ? 'checked' : '' }}>
</script>
</body>
</html>